<?php
/* @var $this KabupatenController */
/* @var $model Kabupaten */
/* @var $form CActiveForm */
global $region_wilayah;

?>
<div class="form">
    <?php $form = $this->beginWidget('CActiveForm', array(
    'id' => 'kabupaten-form',
    'enableAjaxValidation' => false,)); ?>
    <p class="note">Fields with <span class="required">*</span> are required.</p>
    <?php echo $form->errorSummary($model); ?>
    <table border="0" cellpadding="0" cellspacing="0" id="id-form">
        <tr>
            <th valign="top"><?php echo $model->getAttributeLabel('nama_kabupaten'); ?></th>
            <td class="idform">
                <?php echo $form->textField($model, 'nama_kabupaten', array('size' => 60, 'maxlength' => 250)); ?>
            </td>
            <td class="idform">
                <?php if ($model->hasErrors('nama_kabupaten')) echo "<div class='error-left'></div>"; ?>
                <?php echo $form->error($model, 'nama_kabupaten', array('class' => 'error-inner')); ?>
            </td>
        </tr>
        <tr>
            <th valign="top"><?php echo $model->getAttributeLabel('kode_lokasi'); ?></th>
            <td class="idform">
                <?php echo $form->dropDownList($model, 'kode_lokasi', $region_wilayah, array(
                'empty' => '(Pilih wilayah)',
                'style' => 'width:300px',)); ?>
            </td>
            <td class="idform">
                <?php if ($model->hasErrors('kode_lokasi')) echo "<div class='error-left'></div>"; ?>
                <?php echo $form->error($model, 'kode_lokasi', array('class' => 'error-inner')); ?>
            </td>
        </tr>
        <?if(!$model->isNewRecord) : ?>
        <tr>
            <th>&nbsp;</th>
            <td valign="top">
                <?php
                echo l('Tambah Pengurus',url('kabupatenanggota/create',array('id'=>$model->id_kabupaten)));
                $this->widget('zii.widgets.grid.CGridView', array(
                'id'=>'kabupaten-anggota-grid',
                'dataProvider'=>$model_anggota->search(),
                'columns'=>array(
                array(
                    'header' => 'Laskar',
                    'name' => 'laskar_',
                    'type' => 'raw',
                    'value' => '$data->idLaskar->nama'
                ),
                   // 'jabatan',
                    array(
                    'header' => 'Jabatan',
                    'name' => 'jabatan',
                    'type' => 'raw',
                    'value' => 'U::getPengurusKabupaten($data["jabatan"])'
                ),
                  //  array(
//                        'header' => 'Action',
//                        'name' => 'edit',
//                        'type' => 'html',
//                        'value' => 'l(img(bu()."/img/update.png"),url("kabupatenanggota/update",array("id" => $data->id_anggota)))'
//                    ),
                    
                    array
                        (
                        'class'=>'CButtonColumn',
                        'template'=>' {update}   {delete}',
                        'buttons'=>array
                        (
                            'update' => array
                            (
                                'label'=>'update',
                                'imageUrl'=>bu().'/img/update.png',
                                'url'=>'Yii::app()->createUrl("kabupatenanggota/update", array("id"=>$data->id_anggota))',
                            ),
                            
                            
                            'delete' => array
                            (
                                'label'=>'hapus',
                                'imageUrl'=>bu().'/img/delete.png',
                                'url'=>'Yii::app()->createUrl("kabupatenanggota/delete", array("id"=>$data->id_anggota))',
                            ),
                            
                        ),
                    ),
                ),
            )); ?>
            </td>
            <td class="idform"></td>
        </tr>
        <?endif;?>
        <tr>
            <th>&nbsp;</th>
            <td valign="top">
                <?php echo CHtml::submitButton($model->isNewRecord ? 'Create' : 'Save',
                array('class' => 'form-submit')); ?>
            </td>
            <td class="idform"></td>
        </tr>
    </table>
    <?php $this->endWidget(); ?>
</div><!-- form -->